//
//  FineViewCell.m
//  BeautifulWardrobe
//
//  Created by mac on 16/7/29.
//  Copyright © 2016年 rongshao. All rights reserved.
//

#import "FineViewCell.h"

@implementation FineViewCell
- (instancetype)initWithFrame:(CGRect)frame
{
    self =[super initWithFrame:frame];
    if (self)
    {
        [netRequestMethod sendRequestMethod:@"GET" withRequestURL:@"http://api.yuike.com/gmall/api/1.0/home/model_list.php?mid=457465" withHttpBodyDic:nil withRequestBlock:^(NSData *data) {
            NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil];
            _remainingArray = dic[@"data"];
            //添加图片和字
            UIImageView *img = [[UIImageView alloc] initWithFrame:CGRectMake(0, 10, WIDTH, HEIGHT / 5)];
            [img sd_setImageWithURL:[NSURL URLWithString:_remainingArray[0][@"content_data"][@"pic_url"]]];
            [self addSubview:img];
            
            UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(10, CGRectGetMaxY(img.frame) + 10, 100, 15)];
            label.text = @"天猫商城";
            label.textColor = [UIColor colorWithWhite:0.432 alpha:1.000];
            label.font = [UIFont systemFontOfSize:20];
            [self addSubview:label];
            
            UILabel *label2 = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(label.frame)+15, CGRectGetMaxY(img.frame) + 12, 100, 12)];
            label2.text = @"品质保证";
            label2.textColor = [UIColor colorWithWhite:0.593 alpha:1.000];
            [self addSubview:label2];
            
            UIImageView *img2 = [[UIImageView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(label.frame)+10, WIDTH/2, img.frame.size.height * 2)];
            [img2 sd_setImageWithURL:[NSURL URLWithString:_remainingArray[1][@"content_data"][@"left_part"][0][@"pic_url"]]];
            [self addSubview:img2];
            
            UIImageView *img3 = [[UIImageView alloc] initWithFrame:CGRectMake(CGRectGetMaxX(img2.frame), CGRectGetMaxY(label.frame)+10, WIDTH/2, img.frame.size.height)];
            [img3 sd_setImageWithURL:[NSURL URLWithString:_remainingArray[1][@"content_data"][@"right_part"][0][@"pic_url"]]];
            [self addSubview:img3];
            
            UIImageView *img4 = [[UIImageView alloc] initWithFrame:CGRectMake(CGRectGetMaxX(img2.frame), CGRectGetMaxY(img3.frame), WIDTH/2, img.frame.size.height)];
            [img4 sd_setImageWithURL:[NSURL URLWithString:_remainingArray[1][@"content_data"][@"right_part"][1][@"pic_url"]]];
            [self addSubview:img4];
            
            UILabel *label3 = [[UILabel alloc] initWithFrame:CGRectMake(10, CGRectGetMaxY(img4.frame) + 10, 100, 15)];
            label3.text = @"精品市场";
            label3.textColor = [UIColor colorWithWhite:0.432 alpha:1.000];
            label3.font = [UIFont systemFontOfSize:20];
            [self addSubview:label3];
            
            UILabel *label4 = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(label3.frame)+15, CGRectGetMaxY(img4.frame) + 12, 120, 12)];
            label4.text = @"提高时尚品味";
            label4.textColor = [UIColor colorWithWhite:0.593 alpha:1.000];
            [self addSubview:label4];
            
            
            UIImageView *image = [[UIImageView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(label4.frame)+10, WIDTH/2, img4.frame.size.height - 40)];
            [image sd_setImageWithURL:[NSURL URLWithString:_remainingArray[2][@"content_data"][@"left_part"][0][@"pic_url"]]];
            [self addSubview:image];
            
            UIImageView *image2 = [[UIImageView alloc] initWithFrame:CGRectMake(CGRectGetMaxX(image.frame)+1, CGRectGetMaxY(label4.frame)+10, WIDTH/2, image.frame.size.height)];
            [image2 sd_setImageWithURL:[NSURL URLWithString:_remainingArray[2][@"content_data"][@"left_part"][1][@"pic_url"]]];
            [self addSubview:image2];

            UIImageView *image3 = [[UIImageView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(image2.frame)+1, WIDTH/2, img4.frame.size.height - 40)];
            [image3 sd_setImageWithURL:[NSURL URLWithString:_remainingArray[2][@"content_data"][@"right_part"][0][@"pic_url"]]];
            [self addSubview:image3];

            UIImageView *image4 = [[UIImageView alloc] initWithFrame:CGRectMake(CGRectGetMaxX(image.frame)+1, CGRectGetMaxY(image2.frame)+1, WIDTH/2, image.frame.size.height)];
            [image4 sd_setImageWithURL:[NSURL URLWithString:_remainingArray[2][@"content_data"][@"right_part"][1][@"pic_url"]]];
            [self addSubview:image4];
            
            UILabel *label5 = [[UILabel alloc] initWithFrame:CGRectMake(WIDTH/2-35, CGRectGetMaxY(image4.frame)+10, 100, 20)];
            label5.text = @"精品推荐";
            [self addSubview:label5];
            
            UIImageView *xianImg = [[UIImageView alloc] initWithFrame:CGRectMake(5, CGRectGetMaxY(image4.frame)+19, WIDTH/2-60, 3)];
            xianImg.image = [UIImage imageNamed:@"line_activity"];
            [self addSubview:xianImg];
            
            UIImageView *xianImg2 = [[UIImageView alloc] initWithFrame:CGRectMake(CGRectGetMaxX(label5.frame)-10,CGRectGetMaxY(image4.frame)+19, WIDTH/2-60, 3)];
            xianImg2.image = [UIImage imageNamed:@"line_activity"];
            [self addSubview:xianImg2];

        }];
       
    }
    return self;
}
@end
